<?php

namespace App\Models;

use App\Helpers\RequestCriteria;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Operation extends Model
{
    use HasFactory, RequestCriteria;
    protected $fillable = [
        'user_name',
        'type',
        'user_id',
        'e_s_cluster_id',
        'description',
        'status',
        'alarm_id',
        'alarm_type',
        'time'
    ];

    protected $casts = [
        'updated_at' => 'datetime:Y-m-d H:i:s',
        'created_at' => 'datetime:Y-m-d H:i:s',
    ];

    public function ESCluster()
    {
        return $this->belongsTo(ESCluster::Class);
    }
    public function alarm()
    {
        return $this->morphTo('alarm');
    }

}
